<%--
  Created by IntelliJ IDEA.
  User: 86156
  Date: 2024/12/19
  Time: 20:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

    <form action="/emp/confirmAdd" method="post" enctype="multipart/form-data">
        <input type="file" name="myfile" id="myfile" onchange="fun()"/><br>
        <input type="text" name="empName"><br>
        <input type="text" name="empJob"><br>
        <input type="number" name="empSalary"><br>
        <select name="did">
          <c:forEach items="${requestScope.depts}" var="d">
             <option ${d.deptId==emp.did?'selected':''} value="${d.deptId}">${d.deptName}</option>
           </c:forEach>
        </select>
         <input type="submit" value="添加">
    </form>

</body>
<script>
    function fun() {
        var file = document.getElementById("myfile").files[0];
        var reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = function (e) {
            document.getElementById("img").src = e.target.result;
        }
    }
</script>
</html>
